import java.io.*;
import java.util.*;

public class Main {
    enum READING_FIELD {
        NO, // int
        CNO, // varchar
        GRADE// varchar
    }

    public static void main(String[] args) throws IOException {
        READING_FIELD field = READING_FIELD.NO;
        List<Integer> NOs = new ArrayList<>();
        List<String> CNOs = new ArrayList<>();
        List<Integer> grades = new ArrayList<>();
        READ: try (Scanner scanner = new Scanner(new File("c.txt"))) {
            System.out.println("open");
            System.out.println("dropping " + scanner.nextLine());
            while (scanner.hasNextLine()) {
                String line = scanner.nextLine();
                String[] words = line.split(" ");
                if (words.length != 2) {
                    System.out.println("Invalid input: " + line);
                    continue;
                }
                String info = words[1];
                System.out.print("Got" + info);
                System.out.print(' ');
                switch (field) {
                    case NO:
                        try {
                            int n = Integer.parseInt(info);
                            System.out.print(" " + n);
                            NOs.add(n);
                        } catch (NumberFormatException e) {
                            System.out.println("Invalid input: " + line);
                            field = READING_FIELD.CNO;
                            System.out.println("Switching to fit state CNO");
                        }

                        break;
                    case CNO:
                        String[] cno = info.split("-");
                        System.out.println(Arrays.toString(cno));
                        if (cno.length != 2) {
                            System.out.println("Invalid input: " + info);
                            field = READING_FIELD.GRADE;
                            System.out.println("Switching to fit state GRADE");
                        } else {
                            CNOs.add(info);
                            System.out.print(" " + info);
                        }
                        break;
                    case GRADE:
                        try {
                            grades.add(Integer.parseInt(info));
                        } catch (Exception e) {
                            break READ;
                        }
                    default:
                        break;
                }

            }
        }
        if (NOs.size() != CNOs.size() || CNOs.size() != grades.size()) {
            System.out.println("Invalid sizes");
            System.out.println(NOs.size());
            System.out.println(CNOs.size());
            System.out.println(grades.size());
            return;
        }
        System.out.println();
        for (int i = 0; i < NOs.size(); i++) {
            System.out.println("(" + NOs.get(i) + ",\t'" + CNOs.get(i) + "',\t" + grades.get(i) + "),");
        }
    }
}